package com.zxm.template;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import javax.print.attribute.standard.MediaName;

import freemarker.template.Template;
import freemarker.template.TemplateException;

public class MyTemplete {

	public static void main(String[] args) throws IOException, TemplateException {
		String string = "姓名:${username},年龄:${age}";
		Map<String, Object> map = new HashMap<>();
		map.put("username","zhang三");
		map.put("age", "15");
		Template template = new Template(null,string, null);
		Writer writer = new StringWriter();
		template.process(map, writer);
		System.out.println(writer.toString());
	}
}
